const HrefMixin = {
  methods: {
    absHref(href) {
      if (!href) return ''
      if (typeof href !== 'string') return ''
      if (href.indexOf('http') >= 0) {
        return href
      }

      const site = this.$site || {}
      const base = site.base || ''
      if (href.indexOf(base) >= 0) {
        return href
      }

      return base + href
    }
  }
}

export default HrefMixin